home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / FrexxEd / fpl / FileFilter.FPL < prev    next >
Encoding:
Text File  |  1996-09-27  |  849 b   |  44 lines

  1.  
  2. export int LoadFilter(string fullfile, string filter, string options)
  3. {
  4.   int i;
  5.   string tempfile;
  6.   while( i++<10 ) {
  7.     tempfile = sprintf("T:LFilter.%ld", i);
  8.     if(!Check(tempfile))
  9.       break;
  10.   }
  11.   if(i == 10)
  12.     return 0;
  13.   System(sprintf("%s <\"%s\" >%s %s", filter, fullfile, tempfile, options));
  14.  
  15.   i = Load(tempfile);
  16.  
  17.   if(!i) {
  18.     Rename(fullfile);
  19.     SetInfo(-1, "changes", 1);
  20.   }
  21.   System(sprintf("delete %s", tempfile));
  22.   return i;
  23. }
  24.  
  25. export int SaveFilter(string fullfile, string filter, string options)
  26. {
  27.   int i;
  28.   string tempfile;
  29.   while( i++<10 ) {
  30.     tempfile = sprintf("T:SFilter.%ld", i);
  31.     if(!Check(tempfile))
  32.       break;
  33.   }
  34.   if(i == 10)
  35.     return 0;
  36.  
  37.   Save(tempfile);
  38.  
  39.   System(sprintf("%s <%s >\"%s\" %s", filter, tempfile, fullfile, options));
  40.  
  41.   System(sprintf("delete %s", tempfile));
  42.   return i;
  43. }
  44.